#!/bin/bash
DT='2022-05-17'
#if [[ $1 == "" ]];then
#   DT=`date -d '1 days ago' "+%Y-%m-%d"`
#else
#   DT=$1
#fi
if [[ $1 == "" ]];then
   db=zx_ods
else
   db=$1
fi

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '${DT}' as dt from customer where 1=1 and  \$CONDITIONS" \
--hcatalog-database ${db} \
--hcatalog-table customer \
-m 1

/usr/bin/sqoop import "-Dorg.apache.sqoop.splitter.allow_text_splitter=true" \
--connect 'jdbc:mysql://106.75.33.59:3306/scrm?useUnicode=true&characterEncoding=UTF-8&autoReconnect=true' \
--username itcast_edu_stu \
--password itcast_edu_stu \
--query "select *, '${DT}' as dt from customer where 1=1 and  \$CONDITIONS" \
--hcatalog-database ${db} \
--hcatalog-table customer \
-m 1
